package org.example.factory.easy;

import org.example.factory.service.Action;
import org.example.factory.service.impl.JumpAction;
import org.example.factory.service.impl.RunAction;
import org.example.factory.service.impl.SingAction;

public class ActionEasyFactory {

    // 根据类型创建对应的动作
    public static Action createAction(String type) {
        if ("sing".equalsIgnoreCase(type)) {
            return new SingAction();
        } else if ("jump".equalsIgnoreCase(type)) {
            return new JumpAction();
        } else if ("run".equalsIgnoreCase(type)) {
            return new RunAction();
        } else {
            throw new IllegalArgumentException("不支持的动作类型：" + type);
        }
    }
}